﻿--修改来源
CREATE proc [dbo].[proc_Employee_ZhiWu_Update]
(
	@title nvarchar(50),	
	@id int,
	@Pid int
)
as
begin
if @Pid=0
   Begin
    update Employee_ZhiWu set Title=@title where Id=@id
	end
else 
   begin
	declare @ct int,@pxnum_new varchar(50)
	set @ct=(select count(0) from Employee_ZhiWu where Pid=@Pid)+1
	set @pxnum_new=''+CAST(@Pid as varchar)+''+'0'+''+CAST(@ct as varchar)+''
		update Employee_ZhiWu set title=@title,
		Pid=@Pid,
		PxNum=@pxnum_new,
		UpTime=getdate() WHERE Id=@id
end

end
